<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<input :value="txt" @input="txt = arguments[0].target.value"/>
			<input :value="txt" @input="txt = arguments[0].target.value"/>
			
			<br />
			
			<char-input v-model="txt"></char-input>
			<p>{{txt}}</p>
			
		</div>
		
		
		
		
	</body>
	<script src="vue.js"></script>
	<script type="text/html" id="char-input">
		<input :value="value" @input="txtChange"/>
	</script>
	<script>
	
		Vue.component("char-input",{
			props:["value"],
			template:"#char-input",
			methods:{
				txtChange:function(e){
					if(e.target.value.match(/^[a-zA-Z]*$/)){
						this.$emit("input",e.target.value);
					}else{
						e.target.value = this.value;
					}
				}
			}
		});
	
	
		var app = new Vue({
			el:"#app",
			data:{
				txt:""
			}
			
		});
		
		
		//argument是函数中的一个特殊变量，表示函数本次
		//调用时传递的多有参数，是一个类数组
//		function func(){
//			console.dir(arguments);
//		}
//		func(1,"qwe",true);
		
		
		
	</script>
</html>
